import Vue from 'vue'
import VueRouter from 'vue-router'
// 公共页面
import main from '../views/Layout/main.vue'

// 平台端
import showCompanyInfo from '../views/HousekeepingPlatform/showCompanyInfo.vue'
import managementOrder from '../views/HousekeepingPlatform/managementOrder.vue'
import queryCustomerNeeds from '../views/HousekeepingPlatform/queryCustomerNeeds.vue'
import customizeInfoService from '../views/HousekeepingPlatform/customizeInfoService.vue'
import manageStaff from '../views/HousekeepingPlatform/manageStaff.vue'
import reportData from '../views/HousekeepingPlatform/reportData.vue'
import manageService from '../views/HousekeepingPlatform/manageService.vue'
import manageMyOrder from '../views/HousekeepingPlatform/manageMyOrder.vue'
import chat from '../views/HousekeepingPlatform/chat.vue'
import manageMyInfo from '../views/HousekeepingPlatform/manageMyInfo.vue'

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)

}
export const routes = [

    {
        path: '/',
        name: 'Main',
        component: main,
        children: [{
            path: '/',
            name: "showCompanyInfo",
            label: "公司信息",
            icon: "s-home",
            component: showCompanyInfo,
        }, {
            path: '/HousekeepingPlatform/manageMyInfo',
            name: "manageMyInfo",
            label: "个人信息",
            icon: "s-data",
            component: manageMyInfo,
        }]
    },
]

export const asyncRoutes = [{
        path: '/HousekeepingPlatform/reportData',
        name: "reportData",
        label: "报表",
        icon: "s-data",
        component: reportData,
        roles: ['ADMIN'],
    },



    {
        path: '/HousekeepingPlatform/queryCustomerNeeds',
        name: "queryCustomerNeeds",
        label: "客户需求查询",
        icon: "s-comment",
        component: queryCustomerNeeds,
        roles: ['ADMIN'],
    },


    {
        path: '/HousekeepingPlatform/managementOrder',
        name: "managementOrder",
        label: "订单管理",
        icon: "s-order",
        component: managementOrder,
        roles: ['ADMIN'],
    },
    {
        path: '/HousekeepingPlatform/customizeInfoService',
        name: "customizeInfoService",
        label: "智能客服模板定制",
        icon: "s-opportunity",
        component: customizeInfoService,
        roles: ['ADMIN', 'CALL'],
    },
    {
        path: '/HousekeepingPlatform/manageStaff',
        name: "manageStaff",
        label: "家政人员管理",
        icon: "s-custom",
        component: manageStaff,
        roles: ['ADMIN'],
    },
    {
        path: '/HousekeepingPlatform/manageService',
        name: "manageService",
        label: "服务管理",
        icon: "s-cooperation",
        component: manageService,
        roles: ['ADMIN'],
    },
    {
        path: '/HousekeepingPlatform/manageMyOrder',
        name: "manageMyOrder",
        label: "我的订单",
        icon: "s-order",
        component: manageMyOrder,
        roles: ['STAFF'],
    },
    {
        path: '/HousekeepingPlatform/chat',
        name: "chat",
        label: "聊天室",
        icon: "s-order",
        component: chat,
        roles: ['CALL'],
    },
]

const router = new VueRouter({
    routes
})

export default router